<template>
        <el-button :type="type" :size="size" :disabled="!hasPerms(perms)" :icon="icon" @click="btnClick" :label="label">
        </el-button>

</template>

<script>
    import {hasPermission} from '../permission/index.js'

    export default {
        name: "PermsButton",
        props:{
            type:{
                type: String,
                default: null
            },
            icon:{
                type: String,
                default: null,
            },
            disabled:{
                type:String,
                default: null
            },
            size:{
                type: String,
                default:null
            },
            label:{
                type: String,
                default:null
            },
            perms:{
                type: String,
                default: null
            }
        },

        data(){
            return{

            }
        },
        methods:{
            btnClick(){
                this.$emit('click', {});
            },
            hasPerms(perms){
                return hasPermission(perms);
            }
        }
    }
</script>

<style scoped>

</style>